<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<!-- jsp文件头和头部 -->
<%@ include file="../../system/admin/top.jsp"%>

<!--查看图片插件 -->
<link rel="stylesheet" media="screen" type="text/css"
	href="plugins/zoomimage/css/zoomimage.css" />
<link rel="stylesheet" media="screen" type="text/css"
	href="plugins/zoomimage/css/custom.css" />
<script type="text/javascript" src="plugins/zoomimage/js/jquery.js"></script>
<script type="text/javascript" src="plugins/zoomimage/js/eye.js"></script>
<script type="text/javascript" src="plugins/zoomimage/js/utils.js"></script>
<script type="text/javascript" src="plugins/zoomimage/js/zoomimage.js"></script>
<script type="text/javascript" src="plugins/zoomimage/js/layout.js"></script>
<!--查看图片插件 -->

</head>
<body>
	<div class="container-fluid" id="main-container">
		<div id="main-content" class="clearfix">
				<div class="page-header position-relative">
								<tr>
									<td style="vertical-align: top;"width:80px;><c:if
											test="${QX.add == 1 }">
											<a class="btn btn-small btn-success" onclick="add();">新增<i
												class="icon-pencil"></i></a>
										</c:if> <c:if test="${QX.cha == 1 }">
											<a class="btn btn-small btn-info"
												onclick="window.location.href=window.location.href;">刷新<i
												class="icon-refresh"></i></a>
										</c:if> <c:if test="${QX.del == 1 }">
											<a class="btn btn-small btn-danger"
												onclick="makeAll('确定要删除选中的数据吗?');" title="批量删除">批量删除<i
												class='icon-trash'></i></a>
										</c:if></td>
								</tr>
						</div>
			<!--#breadcrumbs-->



<form action="photo/list.do" method="post" name="Form" id="Form">
			<div class="row-fluid">
				<!-- PAGE CONTENT BEGINS HERE -->
				<div class="row-fluid">
				<label><input type="checkbox"
											id="zcheckbox" /><span class="lbl"></span></label>
					<ul class="ace-thumbnails">
						<!-- 开始循环 -->
						<c:choose>
							<c:when test="${not empty varList}">
								<c:if test="${QX.cha == 1 }">
									<c:forEach items="${varList}" var="var" varStatus="vs">
										<li><label><input type='checkbox' name='ids' value="${var.id}" /><span
															class="lbl"><span class="label label-info">${var.name}</span></span></label>
															<a href="<%=basePath%>/pictures/list.do?recordid=${var.id}"	title="查看图片">
															<c:if test="${var.PATH == '' }">
															<img alt="200x200" src="static/avatars/no_image.jpg" style="width: 200px; height: 200px;" />
															</c:if>
															<c:if test="${var.PATH != '' }">
															<img alt="200x200" src="${var.PATH}" style="width: 200px; height: 200px;" />
															</c:if>
															</a>
												<div class="tags">
												<span
														class="label label-success">图：${var.pcount} 张</span>
													<span
													<span
														class="label label-warning arrowed-in">${var.create_date}</span>
												</div>
										</a>
											<div class="tools tools-bottom">
											<c:if
											test="${QX.edit != 1 && QX.del != 1 && QX.cha != 1 }">
											<span
												class="label label-large label-grey arrowed-in-right arrowed-in"><i
												class="icon-lock" title="无权限"></i></span>
											</c:if>
											
												<c:if test="${var.PATH == '' }">
												<a href="static/avatars/no_image.jpg" title="${var.name}" class="bwGal">
															</c:if>
															<c:if test="${var.PATH != '' }">
															<a href="${var.PATH}" title="${var.name}" class="bwGal">
															</c:if>
											<i class="icon-zoom-in" title="查看大图"></i></a>
											<c:if test="${QX.cha == 1 }">
												<a  title="详细"
												onclick="find('${var.id}');"><i class="icon-tasks" title="查看详细"></i></a>
												 </c:if>
												  <c:if test="${QX.edit == 1 }">
												  <a  title="编辑"
												onclick="edit('${var.id}');"><i class="icon-pencil" title="编辑信息"></i></a>
												 </c:if>
															<c:if test="${QX.del == 1 }">
															  <a  title="删除"
													onclick="del('${var.id}');"><i class="icon-remove red" title="删除信息"></i></a>
											</c:if>
													<c:if test="${QX.edit == 1 }">
															  <a  title="上传图片"
													onclick="upload('${var.id}');"><i class="icon-cloud-upload" title="上传图片"></i></a>
											</c:if>
											</div></li>
									</c:forEach>
								</c:if>
									<c:if test="${QX.cha == 0 }">
											<tr>
												<td colspan="100" class="center">您无权查看</td>
											</tr>
										</c:if>
							</c:when>
								<c:otherwise>
										<tr class="main_info">
											<td colspan="100" class="center">没有相关数据</td>
										</tr>
									</c:otherwise>
						</c:choose>
					</ul>
					
				</div>
				<div class="pagination" style="float: inherit; padding-top: 0px; margin-top: 0px;">${page.pageStr}</div>
				<!-- PAGE CONTENT ENDS HERE -->
			</div>
			</form>
			<!--/row-->

		</div>
		<!--/#page-content-->

	</div>
	<!-- #main-content -->
	</div>
	<!--/.fluid-container#main-container-->

	<!-- 引入 -->
	<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
	<script src="static/js/bootstrap.min.js"></script>
	<script src="static/js/ace-elements.min.js"></script>
	<script src="static/js/ace.min.js"></script>
	<!-- 引入 -->
	<script type="text/javascript">
		
		$(top.hangge());
		
		//检索
		function search(){
			top.jzts();
			$("#Form").submit();
		}
		//清空检索
		function empty(){
			$(':input','#Form').not(':button, :submit, :reset, :hidden').val('').removeAttr('checked').removeAttr('selected');
		}
		//新增
		function add(){
			 top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="新增";
			 diag.URL = '<%=basePath%>photo/goAdd.do';
			 diag.Width = 400;
			 diag.Height = 350;
			 diag.CancelEvent = function(){ //关闭事件
				 if('${page.currentPage}' == '0'){
					 top.jzts();
					 setTimeout("self.location=self.location",100);
				 }else{
					 nextPage(${page.currentPage});
				 }
				diag.close();
			 };
			 diag.show();
		}
		
		//删除
		function del(Id){
			
			if(confirm("确定要删除?")){ 
				top.jzts();
				var url = "<%=basePath%>photo/delete.do?id="+Id+"&tm="+new Date().getTime();
				$.get(url,function(data){
		    		nextPage(${page.currentPage});
				});
			}
		}
		
		//修改
		function edit(Id){
			 top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="编辑";
			 diag.URL = '<%=basePath%>photo/goEdit.do?id='+Id;
			 diag.Width = 400;
			 diag.Height = 350;
			 diag.CancelEvent = function(){ //关闭事件
				 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
					 nextPage(${page.currentPage});
				}
				diag.close();
			 };
			 diag.show();
		}
		
		//详细
		function find(Id){
			 top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="详细";
			 diag.URL = '<%=basePath%>photo/goFind.do?id='+Id;
			 diag.Width = 400;
			 diag.Height = 350;
			 diag.CancelEvent = function(){ //关闭事件
				 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
					 nextPage(${page.currentPage});
				}
				diag.close();
			 };
			 diag.show();
		}
	
		
		</script>

	<script type="text/javascript">
		
		//全选 （是/否）
		function selectAll(){
			 var checklist = document.getElementsByName ("ids");
			   if(document.getElementById("zcheckbox").checked){
			   for(var i=0;i<checklist.length;i++){
			      checklist[i].checked = 1;
			   } 
			 }else{
			  for(var j=0;j<checklist.length;j++){
			     checklist[j].checked = 0;
			  }
			 }
		}

		//批量上传图片
		function upload(Id){
			 top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="上传图片";
			 diag.URL = '<%=basePath%>pictures/goAdd.do?recordid='+Id;
			 diag.Width = 800;
			 diag.Height = 490;
			 diag.CancelEvent = function(){ //关闭事件
				 if('${page.currentPage}' == '0'){
					 top.jzts();
					 setTimeout("self.location=self.location",100);
				 }else{
					 nextPage(${page.currentPage});
				 }
				diag.close();
			 };
			 diag.show();
		}
		
		
		//批量操作
		function makeAll(msg){
			
			if(confirm(msg)){ 
				
					var str = '';
					for(var i=0;i < document.getElementsByName('ids').length;i++)
					{
						  if(document.getElementsByName('ids')[i].checked){
						  	if(str=='') str += document.getElementsByName('ids')[i].value;
						  	else str += ',' + document.getElementsByName('ids')[i].value;
						  }
					}
					if(str==''){
						alert("您没有选择任何内容!"); 
						return;
					}else{
						if(msg == '确定要删除选中的数据吗?'){
							top.jzts();
							$.ajax({
								type: "POST",
								url: '<%=basePath%>photo/deleteAll.do?tm='+new Date().getTime(),
						    	data: {DATA_IDS:str},
								dataType:'json',
								//beforeSend: validateData,
								cache: false,
								success: function(data){
									 $.each(data.list, function(i, list){
											nextPage(${page.currentPage});
									 });
								}
							});
						}
					}
			}
		}
		
		//导出excel
		function toExcel(){
			window.location.href='<%=basePath%>pictures/excel.do';
		}
		</script>
	<style type="text/css">
li {
	list-style-type: none;
}
</style>
	<ul class="navigationTabs">
		<li><a></a></li>
		<li></li>
	</ul>
</body>
</html>

